package com.ht.modules.system.online.cgform.service;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ht.entity.Result;
import com.ht.modules.system.online.cgform.entity.*;
import com.ht.modules.system.online.cgform.model.OnlCgformModel;
import com.ht.modules.system.online.cgform.model.OnlGenerateModel;
import com.ht.modules.system.online.config.exception.BusinessException;
import com.ht.modules.system.online.config.exception.DBException;
import freemarker.template.TemplateException;
import org.hibernate.HibernateException;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

public interface IOnlCgformHeadService extends IService<OnlCgformHead> {


    Result<?> addAll(OnlCgformModel model);

    Result<?> editAll(OnlCgformModel model);

    void doDbSynch(String code, String synMethod) throws HibernateException, IOException, TemplateException, SQLException, DBException;

    void deleteRecordAndTable(String id, boolean isdelrecord) throws DBException, SQLException;

    List<Map<String, Object>> queryListData(String sql);

    OnlCgformEnhanceJs queryEnhance(String code, String type);

    void saveEnhance(OnlCgformEnhanceJs onlCgformEnhanceJs);

    void editEnhance(OnlCgformEnhanceJs onlCgformEnhanceJs);

    OnlCgformEnhanceSql queryEnhanceSql(String formId, String buttonCode);

    void saveEnhance(OnlCgformEnhanceSql onlCgformEnhanceSql);

    void editEnhance(OnlCgformEnhanceSql onlCgformEnhanceSql);

    OnlCgformEnhanceJava queryEnhanceJava(OnlCgformEnhanceJava onlCgformEnhanceJava);

    boolean checkOnlyEnhance(OnlCgformEnhanceJava onlCgformEnhanceJava);

    void saveEnhance(OnlCgformEnhanceJava onlCgformEnhanceJava);

    void editEnhance(OnlCgformEnhanceJava onlCgformEnhanceJava);

    List<OnlCgformButton> queryButtonList(String code, boolean isListButton);

    List<OnlCgformButton> queryButtonList(String code);

    List<String> queryOnlinetables();

    void saveDbTable2Online(String tbname);

    JSONObject queryFormItem(OnlCgformHead head);

    void saveManyFormData(String code, JSONObject json) throws DBException, BusinessException;

    Map<String, Object> queryManyFormData(String code, String id) throws DBException;

    void editManyFormData(String code, JSONObject json) throws DBException, BusinessException;

    void executeEnhanceJava(String buttonCode, String eventType, OnlCgformHead head, JSONObject json) throws BusinessException;

    void executeEnhanceSql(String buttonCode, String formId, JSONObject json);

    void executeCustomerButton(String buttonCode, String formId, String dataId) throws BusinessException;

    OnlCgformEnhanceJs queryEnhanceJs(String formId, String cgJsType);

    void deleteOneTableInfo(String formId, String dataId) throws BusinessException;

    void generateCode(OnlGenerateModel model) throws Exception;
}
